<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>鼠标经过按钮折叠效果</title>

  <style>
    button {
      position: relative;
      font-size: 1.2rem;
      padding: 0.7rem 1.4rem;
      background-color: #bf0426;
      text-decoration: none;
      border: none;
      border-radius: 0.5rem;
      color: #dedede;
      box-shadow: 0.5rem 0.5rem 0.5rem rgba(0, 0, 0, 0.3);
    }

    button::before {
      position: absolute;
      content: '';
      width: 0;
      height: 0;
      top: 0;
      left: 0;
      background: linear-gradient(135deg, rgba(33, 33, 33, 1) 0%, rgba(33, 33, 33, 1) 50%, rgba(150, 4, 31, 1) 50%, rgba(191, 3, 38, 1) 60%);
      /* background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 1) 50%, rgba(150, 4, 31, 1) 50%, rgba(191, 3, 38, 1) 60%); */
      border-radius: 0 0 0.5rem 0;
      box-shadow: 0.2rem 0.2rem 0.3rem rgba(0, 0, 0, 0.3);
      transition: 0.3s;
    }

    /* 这种链接伪类先后顺序被称为 LVHA 顺序：:link — :visited — :hover — :active。 */
    button:hover::before {
      width: 1.6rem;
      height: 1.6rem;
    }

    /* 按钮激活时的样式 */
    button:active {
      box-shadow: 0.2rem 0.2rem 0.3rem rgba(0, 0, 0, 0.3);
      transform: translate(0.1rem, 0.1rem);
    }
  </style>
</head>

<body>
  <button>
    <b>Fold me!</b>
  </button>
</body>

</html>